<template>
	<view class="orderListBox">
		<view class="headerBox">
			<image style="width:150rpx;height: 150rpx;" src="@/static/images/头像.png" mode=""></image>
			<view style="margin: 30rpx 0;font-size: 34rpx; font-weight: bold;">
				{{userInfo.username||'--'}}
			</view>
			<view style="font-size: 30rpx;">
				账号：{{userInfo.phone||'--'}}
			</view>

			<view class="BasicInformation1" @click="NoClick">
				基础信息
				<view class="triangle"></view>
			</view>
			<view class="BasicInformation2" @click="logOut">
				退出登录
				<view class="triangle"></view>
			</view>
		</view>
		<view class="contacts">
			<text>联系益鸟</text>
			<text>官方客服：4000-987-009</text>
			<text>益鸟供应链：180-3071-8397</text>
		</view>
		<!-- 退出登录弹框 -->
		<view class="loguot_box" v-if="logOutShow">
			<view class="model">
				<view class="title">
					提示
				</view>
				<view class="content">
					<view style="margin: 50rpx 0;color: #606266;">
						确定退出当前账号？
					</view>
				</view>
				<view class="button">
					<view class="cancel" @click="cancelEvent">
						取消
					</view>
					<view class="confirm" @click="confirmEvent">
						确认
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script setup>
	import {
		onHide,
		onLaunch,
		onLoad,
		onShow,
	} from '@dcloudio/uni-app';

	import {
		ref
	} from 'vue';
	import {
		SCM_logout
	} from '@/api/api.js' //引入api接口
	const userInfo = ref({})
	const logOutShow = ref(false)
	onLoad(() => {
		userInfo.value = uni.getStorageSync('userInfo') && JSON.parse(uni.getStorageSync('userInfo'))

		// #ifdef MP-WEIXIN
		// 开启小程序原生右上角分享按钮
		uni.showShareMenu({
			withShareTicket: true,
			menus: ['shareAppMessage', 'shareTimeline'] //开启转发好友和转发朋友圈按钮
		});
		// #endif
	})
	const NoClick = () => {
		uni.showToast({
			title: '敬请期待',
			duration: 2000,
			mask: true

		});
	}
	const logOut = () => {
		logOutShow.value = true
	}
	const cancelEvent = () => {
		logOutShow.value = false
	}
	const confirmEvent = async () => {
		let user_id = uni.getStorageSync('userInfo').user_id && JSON.parse(uni.getStorageSync('userInfo')).user_id
		if (user_id) {
			const res = await SCM_logout({}, user_id)
		}
		uni.clearStorageSync()
		logOutShow.value = false
		uni.reLaunch({
			url: '/pages/index/index'
		})
	}
</script>

<style lang="scss">
	.orderListBox {
		width: 100vw;
		height: 100%;

		.headerBox {
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			position: relative;
			padding-top: 120rpx;
			padding-bottom: 180rpx;
			background: linear-gradient(180deg, #007742 0%, rgba(0, 119, 66, 0) 100%);

			.BasicInformation1 {
				width: 80%;
				height: 117rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				position: absolute;
				bottom: 5rpx;
				box-shadow: 0rpx 4rpx 6rpx 0rpx rgba(0, 0, 0, 0.08);
				border-radius: 30rpx;
				background: #FFF;
				padding: 0 30rpx;
				font-size: 34rpx;

				.triangle {
					width: 15rpx;
					height: 15rpx;
					border-top: 2rpx solid #262626;
					border-left: 2rpx solid #262626;
					transform: rotate(-225deg);
				}
			}

			.BasicInformation2 {
				width: 80%;
				height: 117rpx;
				display: flex;
				align-items: center;
				justify-content: space-between;
				position: absolute;
				bottom: -140rpx;
				box-shadow: 0rpx 4rpx 6rpx 0rpx rgba(0, 0, 0, 0.08);
				border-radius: 30rpx;
				background: #FFF;
				padding: 0 30rpx;
				font-size: 34rpx;

				.triangle {
					width: 15rpx;
					height: 15rpx;
					border-top: 2rpx solid #262626;
					border-left: 2rpx solid #262626;
					transform: rotate(-225deg);
				}
			}

		}

		.contacts {
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;
			font-size: 32rpx;
			margin-top: 250rpx;
			color: #373737;

			text {
				padding: 5rpx 0;
			}

			text:nth-child(1) {
				margin-bottom: 30rpx;
				font-size: 36rpx;
				font-weight: 700;
			}

		}

		.loguot_box {
			position: fixed;
			top: 0;
			left: 0;
			width: 100vw;
			height: 100vh;
			z-index: 999;
			backdrop-filter: blur(30rpx);
			display: flex;
			justify-content: center;
			align-items: center;

			.model {
				width: 80%;
				padding: 30rpx;
				display: flex;
				border-radius: 20rpx;
				box-shadow: #aaa 0 0 20rpx;
				flex-direction: column;
				justify-content: space-between;
				align-items: center;

				.title {
					font-size: 36rpx;
					font-weight: bold;
				}

				.content {
					font-size: 26rpx;
					margin-top: 30rpx;
					margin-bottom: 50rpx;
				}

				.button {
					width: 100%;
					height: 70rpx;
					display: flex;
					justify-content: space-between;
					align-items: center;
					color: #FFF;

					.cancel {
						display: flex;
						justify-content: center;
						align-items: center;
						width: 45%;
						height: 100%;
						border-radius: 70rpx;
						border: 1px solid #007B46;
						background: #FFF;
						color: #007B46;
					}

					.confirm {
						display: flex;
						justify-content: center;
						align-items: center;
						width: 45%;
						height: 100%;
						border-radius: 70rpx;
						background: #007B46;
					}
				}
			}
		}
	}
</style>